package com.example.demo;

import lombok.Getter;

public enum CodeMsg {

    USER_NOT_EXIST("U0201", "用户不存在"),
    USER_ACCOUNT_LOCKED("U0202", "用户账户被冻结"),
    USER_ACCOUNT_INVALID("U0203", "用户账户无效"),
    USERNAME_OR_PASSWORD_ERROR("U0204", "用户名或密码错误"),
    PASSWORD_ENTER_EXCEED_LIMIT("U0205", "用户输入密码次数超限"),
    PASSWORD_EXPIRED("U0206", "密码已过期"),
    USER_LOGIN_ERROR("U0210", "用户登录异常"),

    CLIENT_AUTHENTICATION_FAILED("C0260", "客户端认证失败"),
    
    TOKEN_INVALID("T0310", "无效token！"),
    TOKEN_EXPIRED("T0310", "token已过期！"),
    TOKEN_NOT_FOUND("T0311", "token未找到"),
    TOKEN_ERROR("T0312", "token解析异常！"),
    AUTHORIZED_ERROR("AU0300", "访问权限异常"),
    ACCESS_UNAUTHORIZED("AU0301", "访问未授权"),
    ACCESS_SCOPE_ERROR("AU0302", "权限范围出错"),
    FORBIDDEN_OPERATION("AU0303", "禁止操作"),
    
    PARAM_ERROR("A0400", "用户请求参数错误"),
    
    RESOURCE_NOT_FOUND("A0401", "请求资源不存在"),
    PARAM_IS_NULL("A0410", "请求参数为空"),
    UPLOAD_FILE_ERROR("A0430", "用户上传文件异常"),
    UPLOAD_FILE_TYPE_NOT_MATCH("A0431", "用户上传文件类型不匹配"),
    UPLOAD_FILE_SIZE_EXCEEDS("A0432", "用户上传文件太大"),
    UPLOAD_IMAGE_SIZE_EXCEEDS("A0433", "用户上传图片太大"),
    
    DIP_CHECK_ERROR("D4000", "DIP检测出错！"),
    
    GATEWAY_EXECUTION_ERROR("G0502", "网关执行出错"),
    GATEWAY_EXECUTION_TIMEOUT("G0504", "网关执行超时"),
    
    SYSTEM_ACCESS_ERROR("S0600", "系统访问异常"),
    SYSTEM_EXECUTION_TIMEOUT("S0601", "系统执行超时"),
    SYSTEM_DATA_NULL("S0604", "系统数据为空"),
    SYSTEM_DISASTER_RECOVERY_TRIGGER("S0620", "系统容灾功能被出发"),
    FLOW_LIMITING("S0621", "系统限流"),
    DEGRADATION("S0622", "系统功能降级"),
//    SYSTEM_RESOURCE_EXHAUSTION("S0610", "系统资源耗尽"),  
    SYSTEM_READ_DISK_FILE_ERROR("S0611", "系统读取磁盘文件失败"),

    INTERFACE_NOT_EXIST("C0700", "接口不存在"),
    MIDDLEWARE_SERVICE_ERROR("C0702", "中间件服务出错"),
    CALL_THIRD_PARTY_SERVICE_ERROR("C0710", "调用第三方服务出错"),

    MESSAGE_SERVICE_ERROR("M0820", "消息服务出错"),
    MESSAGE_DELIVERY_ERROR("M0821", "消息投递出错"),
    MESSAGE_CONSUMPTION_ERROR("M0822", "消息消费出错"),
    MESSAGE_SUBSCRIPTION_ERROR("M0823", "消息订阅出错"),
    MESSAGE_GROUP_NOT_FOUND("M0824", "消息分组未查到"),

    DATABASE_ERROR("D0900", "数据库服务出错"),
    SQL_RUN_ERROR("D0904", "sql运行异常"),
    DATABASE_RESULT_NULL("D0910", "查询结果为空"),
    DATABASE_TABLE_NOT_EXIST("D0911", "表不存在"),
    DATABASE_COLUMN_NOT_EXIST("D0912", "列不存在"),
    DATABASE_DUPLICATE_COLUMN_NAME("D0921", "多表关联中存在多个相同名称的列"),
    DATABASE_DEADLOCK("D0931", "数据库死锁"),
    DATABASE_PRIMARY_KEY_CONFLICT("D0932", "主键冲突"),
    DATA_EXIST("D0960", "此数据已存在！"),

    RULE_NULL("R9999", "无匹配的规则"),
    RULE_SUCCESS("R0000", "规则执行成功"),
    RULE_TRIGGER_SUCCESS("1001", "触发规则"),
    RULE_HISTORY_NULL("R5555", "无历史数据"),
    RULE_CHECK_ERROR("R4000", "规则检测出错！"),

	REDIS_ERROR("D0940", "REDIS数据出错");


	
	@Getter
	private String code;
	
	@Getter
	private String msg;
	
	
	CodeMsg(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }
	
}
